#!/usr/bin/env node

const fs = require('fs'),
      file = process.argv[2] || __filename;
try {
  //get file 
  let len = fs.statSync(file).size;
  //create buffer
  let buf = Buffer.alloc(len);
  let fid = fs.openSync(file, 'r');
  
  //read
  fs.readSync(fid, buf, 0, len, 0);
  console.log(buf.toString('utf-8'));
  //close
  fs.closeSync(fid);
} catch(err) {
  console.log(err.message);
  process.exit(1);
}
